import 'package:baselib/utils/log_util.dart';
import 'package:get/get.dart';

import 'base_service.dart';

/**
 * 基础逻辑处理类
 */
abstract class BaseViewModel<T extends BaseService> extends GetxController{
  //泛型服务层
  T apiService;
  //全局个人信息
  // UserParamsModel userParamsModel;

  BaseViewModel(){
    // if(userParamsModel==null)userParamsModel=UserParamsModel();
    createService();
  }

  T createService();

  @override
  void onInit() {
    LogUtil.d('BaseViewModel-->onInit');
    super.onInit();
    //Loading, Success, Error handle with 1 line of code
  }

  @override
  void onReady() {
    LogUtil.d('BaseViewModel-->onReady');
    super.onReady();
  }

  @override
  void onClose() {
    LogUtil.d('BaseViewModel-->onClose');
    super.onClose();
  }

  @override
  void didChangeMetrics() {
    LogUtil.d('BaseViewModel-->didChangeMetrics');
  }

  @override
  void didChangePlatformBrightness() {
    LogUtil.d('BaseViewModel-->didChangePlatformBrightness');
  }

  @override
  void onDetached() {
    LogUtil.d('BaseViewModel-->onDetached');
  }

  @override
  void onInactive() {
    LogUtil.d('BaseViewModel-->onInative');
  }

  @override
  void onPaused() {
    LogUtil.d('BaseViewModel-->onPaused');
  }

  @override
  void onResumed() {
    LogUtil.d('BaseViewModel-->onResumed');
  }

}